<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    #box {
      width: 90%;
      border: 1px solid red;
      position: absolute;
      bottom: 0;
      left: 50%;
      height: 70px;
      transition: 0.2s;
      transform: translateX(-50%);
    }
    .box-color {
      height: 200px;
      display: none;
      background-color: beige;
    }
  </style>
</head>
<body>
<div id="box">
  <h3>标题</h3>
  <p>介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍</p>
  <div class="box-color">  </div>
</div>
<script type="text/javascript">
  var target = document.querySelector('#box');
  var targetHeight;
  var els = target.style, y = 0, numHeight, touchObj={};
  // 手指按下
  target.addEventListener('touchstart', function (e) {
    targetHeight = target.offsetHeight
    touchObj.start(e)
  });
  // 手指移动
  target.addEventListener('touchmove', function (e) {
    targetHeight = target.offsetHeight
    touchObj.move(e)
  })
  // 手指按下
  target.addEventListener('touchend', function (e) {
    if(target.offsetHeight>targetHeight) {
      target.style.height='600px'
    }else {
      target.style.height='70px'
    }
    console.log(e)
  });
  touchObj = {
    start(e) {
      y = e.targetTouches[0].pageY + target.offsetHeight;
      // 取消默认滑动
      e.preventDefault()
    },
    // 移动
    move(e) {
      els.height = -e.targetTouches[0].pageY + y + 'px'
      this.eventShow(e)
    },
    // 事件判断
    eventShow(e){
      numHeight = -e.targetTouches[0].pageY + y
      if(numHeight > 260) {
        document.querySelector('.box-color').style.display = 'block'
      }else {
        document.querySelector('.box-color').style.display = 'none'
      }
    }
  }
</script>
</body>
</html>
